<?php echo $this->BlkListProducts(); ?>

<div class="content margin-top-20">
    <div class="group-new02 width-100">
        <div class="group-new02-title">
            <div class="sub-left color-main">
                <a class="link-sub" href="#"><img src="images/icons/icon-new.png" alt=""  /></a>
                <p>Sản phẩm mới</p>
            </div>
        </div>

        <?php
        $lang = $view->arrParam['lang'];
		if(empty($lang)){
		    $lang = 'vi';
		}else{
		    $lang = $view->arrParam['lang'];
		} 
        
        $catPro     = $this->Items;
        foreach($catPro as $cp){
            $cpName     = $cp['name'];
            $cpPrice    = $cp['price'];
            
            $realLink   = FILES_PATH. '/products/images450x450/' . $cp['picture'];
            if(!empty($cp['picture'])){
                if(file_exists($realLink)){
                    $linkImg	= FILES_URL . '/products/images450x450/' . $cp['picture'];
                }
                else{
                    $linkImg	= FILES_URL . '/products/images450x450/no-image.jpg';
                }
                $picture 	= '<img title="'. $cpName .'" src="'. $linkImg .'" width="235" height="190" alt="'.$cpName.'" />';
            }
            else{
                $linkImg	= FILES_URL . '/news/images450x450/no-image.jpg';
                $picture 	= '<img title="'. $cpName .'" src="'. $linkImg .'" width="235" height="190" alt="'.$cpName.'" />';
            }
            
            $urlOptions = array('module'=>'products',
                                    'controller'=>'index',
                                    'action'=>'detail',
                                    'nname'=>$cp['alias'],
                                    'cid'=> $cp['cat_id'],
                                    'id'=>$cp['id'],
                                    'lang'=>$lang);
            $linkDetail = $this->url($urlOptions,'product-detail');
            
        ?>
        <div class="box-cnt width-24 col-1">
            <div class="box2">
                    <div class="sp-img">
                    <?php echo $picture; ?>
                    <div class="price">
                        <p class="price01"><?php echo $cpPrice; ?> VND</p>
                        <p class="price02">Thêm vào giỏ hàng</p>
                    </div>
                </div>
                    <a href="#"><h2><?php echo $cpName; ?></h2></a>
                <div class="box2-link"><a href="<?php echo $linkDetail;?>">Đặt hàng</a></div>
            </div>
            <div class="clear"></div>
        </div>
        <?php } ?>
    <div class="clear"></div>
            <div class="cur-page">
                <?php
                    $paginator = $this->arrParam['paginator'];
                    $itemCountPerPage = $paginator['itemCountPerPage'];
                    if($this->total > $itemCountPerPage){
                            $currentUrl = $this->baseUrl($this->currentController . '/index');
                            echo $this->paginationControl($this->panigator,'Sliding','curentpage.phtml',array('currentUrl'=>$currentUrl,'arrParam'=>$this->arrParam));
                    }
                ?>
            </div>
            <div class="clear"></div>
    </div>
</div>